import Vue from "vue";
import VueRouter from "vue-router";

Vue.use(VueRouter);

const routes = [
  {
    path: "/",
    redirect: "/index",
    component: () => import("@/components/LayoutCom.vue"),
    children: [
      {
        path: "/index", // 首页
        name: "homeIndex",
        component: () => import("@/views/index.vue"),
      },
      {
        path: "/package/i18n", // 国际化
        name: "i18n",
        component: () => import("@/views/package/i18n/index"),
        meta: {
          title: "国际化",
          description: "i18n 国际化",
        },
      },
      {
        path: "/package/vuetreeselect", // 树形选择
        name: "vuetreeselect",
        component: () => import("@/views/package/vuetreeselect/index"),
        meta: {
          title: "vue-treeselect 树形选择",
          description: "vue-treeselect 轻量级树形选择",
        },
      },
      {
        path: "/package/clipboard", // 剪切板
        name: "clipboard",
        component: () => import("@/views/package/clipboard/index"),
        meta: {
          title: "clipboard",
          description: "剪切板",
        },
      },
      {
        path: "/package/echarts", // 图表
        name: "echarts",
        component: () => import("@/views/package/echarts/index"),
        meta: {
          title: "echarts 图表",
          description: "echarts 图表",
        },
      },
      {
        path: "/package/sortablejs", // 可拖拽
        name: "sortablejs",
        component: () => import("@/views/package/sortablejs/index"),
        meta: {
          title: "sortablejs 可拖拽",
          description: "echarts 图表",
        },
      },
      {
        path: "/package/vuecropper", // 图片裁剪
        name: "vuecropper",
        component: () => import("@/views/package/vuecropper/index"),
        meta: {
          title: "vuecropper 图片裁剪上传",
          description: "轻量级图片裁剪",
        },
      },
      {
        path: "/package/mavoneditor", // md 富文本编辑器
        name: "mavoneditor",
        component: () => import("@/views/package/mavoneditor/index"),
        meta: {
          title: "mavoneditor md富文本编辑器",
          description: "md富文本编辑器",
        },
      },
      {
        path: "/package/screenfull", // 全屏
        name: "screenfull",
        component: () => import("@/views/package/screenfull/index"),
        meta: {
          title: "screenfull 全屏",
          description: "全屏",
        },
      },
      {
        path: "/package/pagestyle", // element 样式
        name: "pagestyle",
        component: () => import("@/views/package/pagestyle/index"),
        meta: {
          title: "element 样式",
          description: "修改 element 默认样式",
        },
      },
      {
        path: "/package/test", // 写测试文件
        name: "test",
        component: () => import("@/views/package/test/index"),
        meta: {
          title: "demo 页面",
          description: "写测试文件",
        },
      },
      {
        path: "/package/scalingbox", // 伸缩盒子
        name: "scalingbox",
        component: () => import("@/views/package/scalingbox/index"),
        meta: {
          title: "伸缩盒子",
          description: "可以伸缩盒子边框 改变宽度",
        },
      },
      {
        path: "/package/svg", // svg1
        name: "svg1",
        component: () => import("@/views/package/svg/index"),
        meta: {
          title: "svg filter 实现改色",
          description: "基于 filter 实现 svg 封装",
        },
      },
      {
        path: "/package/jsMind",
        name: "jsMind",
        component: () => import("@/views/package/jsMind/index"),
        meta: {
          title: "JsMind 实现思维导图",
          description: "基于 JsMind 实现 业务 封装",
        },
      },
      {
        path: "/package/iframeScale",
        name: "iframeScale",
        component: () => import("@/views/package/iframe/scale/index"),
        meta: {
          title: "iframe 缩放",
          description: "iframe 缩放",
        },
      },
      {
        path: "/package/jsencrypt",
        name: "jsencrypt",
        component: () => import("@/views/package/jsencrypt/index"),
        meta: {
          title: "jsencrypt 加密传输 与解密",
          description: "jsencrypt 加密传输 与解密",
        },
      },
      {
        path: "/package/excel",
        name: "excel",
        component: () => import("@/views/package/excel/exportExcel/index"),
        meta: {
          title: "excel 导入与导出",
          description: "excel 导入与导出",
        },
      },
      {
        path: "/package/lodash",
        name: "lodash",
        component: () => import("@/views/package/lodash/index"),
        meta: {
          title: "lodash 工具库的使用",
          description: "lodash 工具库的使用",
        },
      },
      {
        path: "/package/v-viewer",
        name: "v-viewer",
        component: () => import("@/views/package/v-viewer/index"),
        meta: {
          title: "v-viewer 工具库的使用",
          description: "v-viewer 工具库的使用",
        },
      },
      {
        path: "/package/luckyExcel",
        name: "luckyExcel",
        component: () => import("@/views/package/luckyExcel/index"),
        meta: {
          title: "luckyExcel 在线表格",
          description: "luckyExcel 在线表格",
        },
      },
      {
        path: "/package/promiseQueue",
        name: "qiankun",
        component: () => import("@/views/package/promiseQueue/index"),
        meta: {
          title: "promise封装 函数执行队列",
          description: "promise封装 函数执行队列",
        },
      },
      {
        path: "/package/IntersectionObserver",
        name: "intersectionObserver",
        component: () => import("@/views/package/IntersectionObserver/index"),
        meta: {
          title: "IntersectionObserver 实现懒加载",
          description: "IntersectionObserver 实现懒加载",
        },
      },
      {
        path: "/package/directive",
        name: "directive",
        component: () => import("@/views/package/directive/index"),
        meta: {
          title: "directive 自定义指令",
          description: "directive 自定义指令",
        },
      },
      {
        path: "/package/word",
        name: "word",
        component: () => import("@/views/package/wordAndPDF/index"),
        meta: {
          title: "页面导出 word 与 打印 导出pdf",
          description: "页面导出 word 与 打印 导出pdf",
        },
      },
      {
        path: "/package/antvx6",
        name: "antvx6",
        component: () => import("@/views/package/antvx6/index"),
        meta: {
          title: "antvx6 使用",
          description: "antvx6 使用",
        },
      },
      {
        path: "/package/elTable",
        name: "elTable",
        component: () => import("@/views/package/element/el-table/index"),
        meta: {
          title: "el-table 二次封装",
          description: "el-table 二次封装",
        },
      },
      {
        path: "/package/vtable",
        name: "vtable",
        component: () => import("@/views/package/vtable/index"),
        meta: {
          title: "vtable",
          description: "vtable",
        },
      },
    ],
  },
];

const router = new VueRouter({
  routes,
});

export default router;
